package edu.uwlax.cs.oayonlinestore.client.utils;

import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;
import com.google.gwt.user.client.ui.HasHorizontalAlignment.HorizontalAlignmentConstant;

public abstract class TitlePage extends StackPage {

	public class StackAsycHandler extends DefaultAsyncCallback {

		public void onSuccess(Object arg0) {
			onDataArrived(arg0);

		}
	}

	private VerticalPanel panel;

	private Title title;

	public void add(Widget w) {
		panel.add(w);
	}

	public void removeAll() {
		panel.clear();// .removeFromParent();

	}

	public StackAsycHandler getAsyncHandler() {
		return new StackAsycHandler();
	}

	protected void onDataArrived(Object o) {
	}

	protected void preCreate() {
		panel = new VerticalPanel();
		setWidget(panel);
		panel.add(title = new Title("Unknown Page"));
	}

	public void setHorizontalAlignment(HorizontalAlignmentConstant a) {
		panel.setHorizontalAlignment(a);
	}

	public void setTitle(String title) {
		this.title.setTitle(title);
	}

	public VerticalPanel getPanel() {
		return panel;
	}
	

}
